package com.dnake.facedemo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.Button
import com.dnake.libface.Face
import com.dnake.v792.api.SysLayer

class FaceActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        instance = this
        setContentView(R.layout.activity_face)
        findViewById<Button>(R.id.back).setOnClickListener{
            finish()
        }

        val view = findViewById<View>(R.id.view_placeholder)
        view.post{
            val intExtra = intent.getIntExtra("mode", 1)
            if(intExtra == 1){
                SysLayer.faceRecognition(72,view)

            }else{
                Face.faceRegister(72,10100001,view)

            }
        }
    }

    companion object{
        lateinit var instance : FaceActivity
    }

    override fun onDestroy() {
        super.onDestroy()
        SysLayer.stopFace()
    }
}